package com.wy2cloud.sample.mongodemo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.wy2cloud.sample.mongodemo.entity.SystemUser;
import com.wy2cloud.sample.mongodemo.repository.UserRepository;

@Service
public class UserService {

	@Autowired
	private UserRepository userRepository;
	
	public void add(SystemUser user) {
		userRepository.insert(user);
	}
	
	public SystemUser findOne(Integer userId) {
		return userRepository.findOne(userId);
	}
	
	public Page<SystemUser> findAll(Pageable pageable){
		return userRepository.findAll(pageable);
	}
}
